import { http } from '@/utils/http'
// 预付订单
export const getMemberOrderPreAPI = () => {
  return http({
    method: 'GET',
    url: '/member/order/pre',
  })
}
// 立即购买订单
export const getOrderPreNowAPI = (data: { skuId: string; count: string; addressId?: string }) => {
  return http({
    method: 'GET',
    url: '/member/order/pre/now',
    data,
  })
}
// 提交订单
export const postMemberOrderAPI = (data: any) => {
  return http<{ id: string }>({
    method: 'POST',
    url: '/member/order',
    data,
  })
}
// 获取订单详情
export const getMemberOrderByIdAPI = (id: string) => {
  return http({
    method: 'GET',
    url: `/member/order/${id}`,
  })
}

/**
 * 获取订单列表
 * @param data orderState 订单状态
 */
export const getMemberOrderAPI = (data: any) => {
  return http({
    method: 'GET',
    url: `/member/order`,
    data,
  })
}
